Crate hyper_socks2

source ·
Expand description

A SOCKS5 connector for hyper library

§Example

use hyper::{Body, Uri};
use hyper::client::{Client, HttpConnector};
use hyper_socks2::SocksConnector;

let mut connector = HttpConnector::new();
connector.enforce_http(false);
let proxy = SocksConnector {
    proxy_addr: Uri::from_static("socks5://your.socks5.proxy:1080"), // scheme is required by HttpConnector
    auth: None,
    connector,
};

// with TLS support
let proxy = proxy.with_tls()?;

let client = Client::builder().build::<_, Body>(proxy);

§Features

  • tls feature is enabled by default. It adds TLS support using hyper-tls.
  • rustls feature adds TLS support using hyper-rustls.

Structs§

  • Required for a username + password authentication.
  • A SOCKS5 proxy information and TCP connector
  • An error returned from the TLS implementation.

Enums§

Type Aliases§